CREATE TABLE [dbo].[App_desrec]
(
[id_desrec] [dbo].[_codigo] NOT NULL,
[id_lista] [dbo].[_codigo] NOT NULL,
[id_entidad] [dbo].[_codigo] NULL,
[id_rubro] [dbo].[_codigo] NULL,
[id_categ_art] [dbo].[_codigo] NULL,
[id_articulo] [dbo].[_codigo] NULL,
[porcentaje] [dbo].[_importe] NULL,
[signo] [dbo].[_importe] NULL,
[orden_aplica] [dbo].[_importe] NULL
) ON [PRIMARY]
GO
ALTER TABLE [dbo].[App_desrec] ADD CONSTRAINT [PK_desrec] PRIMARY KEY CLUSTERED  ([id_desrec]) ON [PRIMARY]
GO
ALTER TABLE [dbo].[App_desrec] ADD CONSTRAINT [FK_App_desrec_App_articulo] FOREIGN KEY ([id_articulo]) REFERENCES [dbo].[App_articulo] ([id_articulo])
GO
ALTER TABLE [dbo].[App_desrec] ADD CONSTRAINT [FK_App_desrec_App_categ_art] FOREIGN KEY ([id_categ_art]) REFERENCES [dbo].[App_categ_art] ([id_categ_art])
GO
ALTER TABLE [dbo].[App_desrec] ADD CONSTRAINT [FK_App_desrec_App_entidad] FOREIGN KEY ([id_entidad]) REFERENCES [dbo].[App_entidad] ([id_entidad])
GO
ALTER TABLE [dbo].[App_desrec] ADD CONSTRAINT [FK_App_desrec_App_lista] FOREIGN KEY ([id_lista]) REFERENCES [dbo].[App_lista] ([id_lista])
GO
ALTER TABLE [dbo].[App_desrec] ADD CONSTRAINT [FK_App_desrec_App_rubro] FOREIGN KEY ([id_rubro]) REFERENCES [dbo].[App_rubro] ([id_rubro])
GO
EXEC sp_bindefault N'[dbo].[cero]', N'[dbo].[App_desrec].[porcentaje]'
GO
EXEC sp_bindefault N'[dbo].[cero]', N'[dbo].[App_desrec].[signo]'
GO
EXEC sp_bindefault N'[dbo].[cero]', N'[dbo].[App_desrec].[orden_aplica]'
GO
EXEC sp_addextendedproperty N'MS_Description', N'(comercio)', 'SCHEMA', N'dbo', 'TABLE', N'App_desrec', 'COLUMN', N'id_entidad'
GO
